// OrderDetailsController.java
package com.wg.msorderds.controller;

import com.wg.msorderds.entity.OrderDetails;
import com.wg.msorderds.service.IOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order/OrderDetails")
public class OrderDetailsController {
    @Autowired
    private IOrderDetailService orderDetailService;

    @PostMapping("/add")
    public boolean save(@RequestBody OrderDetails orderDetails){
        return orderDetailService.save(orderDetails);
    }

    @DeleteMapping("/delete")
    public boolean delete(Integer id){
        return orderDetailService.removeById(id);
    }
    @PutMapping("/update")
    public boolean update(@RequestBody OrderDetails orderDetails){
        return orderDetailService.updateById(orderDetails);
    }
    @GetMapping("/get")
    public OrderDetails get(Integer id){
        return orderDetailService.getById(id);
    }
    @GetMapping("/list")
    public List<OrderDetails> list(){
        return orderDetailService.list();
    }
}
